﻿
@{
    Layout = null;

}


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    
    <link href="~/BootstrapS/css/plugins/iCheck/custom.css" rel="stylesheet" />
    <link href="~/BootstrapS/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>
<body>
    <h3 class="modal-title" id="myModalAdd">新增医生登记信息</h3>
    <div id="adddiv">


        <div style="width:45%;float:left;margin-left:20px;margin-top:15px">
            医生
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="Name" placeholder="请输入用户名">
            <br /><br />
            医龄
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="Age" placeholder="请填写医龄信息">
            <br /><br />

            性别
            <input type="radio" id="sex1" name="sexname" v-model="sex" value="男">
            <label for="男">男</label>
            <input type="radio" id="sex2" name="sexname" v-model="sex" style="margin-left:20px" value="女">
            <label for="女">女</label>
            <br /><br />
            邮箱地址
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="Email" placeholder="请填写邮箱地址">
            <br /><br />



            医生职称<br />
            <select class="btn btn-outline btn-success" style="width:200px" v-model="Profid">
                <option style="background-color:white;color:black" v-bind:value="0">请选择职称</option>
                <option style="background-color:white;color:black" v-for="item in pfl" v-bind:value="item.professional_Id">{{item.professional_Name}}</option>
            </select>
            <br /><br /><br />

            输入其他备注:
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="Remark" placeholder="请输入其他备注">
            <br /><br />

        </div>


        <div style="width:45%;float:right;margin-left:10px;margin-top:15px">
            身份证号
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="IDnumber" placeholder="请输入身份证号">
            <br /><br />
            出生日期
            <input id="hello" class="laydate-icon form-control layer-date" v-model="BirthDay" style="width:240px" placeholder="请选择出生日期">

            <br /><br />
            家庭住址
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="Home" placeholder="请填写出生年月日">
            <br /><br />

            所属科室<br />
            <select class="btn btn-outline btn-success" style="width:200px" v-model="outid">
                <option v-bind:value="0">请选择就诊科室</option>
                <option v-for="itemo in opt" v-bind:value="itemo.outpatient_Id">{{itemo.outpatient_Name}}</option>
            </select>
            <br /><br /><br />
            联系方式
            <input type="search" class="form-control input-sm" aria-controls="DataTables_Table_0" style="width:240px" v-model="Iphone" placeholder="请填写手机号">
            <br /><br />
        </div>




        <div class="modal-footer">
            <div>
                <button type="button" class="btn btn-outline btn-default" data-dismiss="modal">退出</button>
                <button type="button" class="btn btn-outline btn-warning" v-on:click="adddoctors">提交</button>
            </div>

        </div>
    </div>
</body>
</html>

<script src="~/BootstrapS/js/jquery.min.js"></script>
<script src="~/BootstrapS/js/bootstrap.min.js"></script>
<script src="~/BootstrapS/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="~/BootstrapS/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="~/BootstrapS/js/plugins/layer/layer.min.js"></script>


<script src="~/BootstrapS/js/contabs.min.js"></script>
<script src="~/BootstrapS/js/plugins/pace/pace.min.js"></script>
<script src="~/vue/axios.min.js"></script>
<script src="~/vue/qs.min.js"></script>
<script src="~/vue/vue.min.js"></script>
<script src="~/BootstrapS/js/plugins/iCheck/icheck.min.js"></script>
<script src="~/BootstrapS/js/plugins/sweetalert/sweetalert.min.js"></script>

<script>
    new Vue({
        el: '#adddiv',
        data: {
            pfl: null,
            opt: null,
            Name: '',
            Age: '',
            Email: '',
            Remark: '',
            outid: 0,
            Profid: 0,
            sex: '',
            IDnumber: '',
            BirthDay: '',
            Iphone: '',
            Home: '',
        },
        mounted() {
            function gpf() {
                return axios
                    .get('/Doctor/GetProfessionals');
            }
            function got() {
                return axios
                    .get('/Doctor/GetOutpatient')
            }
            axios.all([gpf(), got()])

                .then(axios.spread((pfls, opts) => {

                    this.pfl = pfls.data;
                    this.opt = opts.data;

                }))
                .catch(err => {
                    console.log(err);
                })
        },
        methods: {
            adddoctors() {
                var obj = {

                    Doctor_Name: this.Name,
                    Doctor_Age: this.Age,
                    Doctor_Email: this.Email,
                    Doctor_Remark: this.Remark,
                    Outpatient_Id: this.outid,
                    Professional_Id: this.Profid,
                    Doctor_State: 1,
                    Streat: 0,
                    Doctor_Sex: this.sex,
                    Doctor_Home: this.Home,
                    Doctor_IDnumber: this.IDnumber,
                    Doctor_Birthday: this.BirthDay,
                    Doctor_Iphone: this.Iphone
                }
                axios
                    .post('/Doctor/AddDoctor', window.Qs.stringify(obj))
                    .then(function (response) {
                        if (response.data.success == true) {
                            alert("添加成功!");
                            location.href ='/Doctor/DoctorIndex'
                        }
                        else {

                            alert("添加失败!");
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    })
            }
        }
    })

</script>
